<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="renderer" content="webkit">
<meta http-equiv="x-dns-prefetch-control" content="on">
<meta name="keywords"
	content="心课堂,心教育,远程教育,公开课,网络公开课,在线学习,在线教育,在线培训,在线课堂,名师讲堂,视频课程">
<meta name="description" itemprop="description"
	content="快来直播教室观看直播课程，并参与现场讨论，让学习成就梦想！">
<meta itemprop="name" content="心课堂-直播教室">
<meta itemprop="image"
	content="//9.url.cn/edu/lego_modules/edu-ui/0.0.1/img/nohash/logo_pc_rich.png">
<title>${obj.title!}</title>
<script type="text/javascript" src="${root}js/jquery.min.js"></script>
	<link rel="stylesheet" href='${root}assets/layui/css/layui.css' />
<link rel="stylesheet" href='${root}css/barrager.css' />
<script type="text/javascript" src="${root}js/jquery.barrager.js"></script>
<script type="text/javascript">
/*var looper_time=5*1000;
//是否首次执行
var run_once=true;
do_barrager();
function do_barrager(){
  if(run_once){
      //如果是首次执行,则设置一个定时器,并且把首次执行置为false
      looper=setInterval(do_barrager,looper_time);                
      run_once=false;
  }
  
  //获取
  $.getJSON('${root}json/zb/danmu?id=${obj.id!1}',function(data){
	  //是否有数据
      if(data!=null){
           $('#player').barrager(data);
      }
  });
}

do_barrager();*/
setInterval(addnum,(1,30)*1000)
function addnum(){
	var num=parseInt($("#num").text());
	if(num<10000000){
	$.get('${root}json/zb/addnum?id=${obj.id!1}',function(data){
		var rtvnum=parseInt(data.num);
		 $("#num").text(rtvnum);
		 /*for (var i = 0; i <1; i++) {
			 $(".chat-list").append("<div class=\"student\">\n" +
						"								<span class=\"nick\"><font color=\"red\">"+data.name+"</font>加入房间</span> <i class=\"icon-font i-alert\" title=\"信息发送失败\" style=\"display: none;\"></i> " +
						"							</div>")
			  var len=$('.chat-list').children().length;
					if(len==7){
					$(".chat-list").find(".student")[0].remove();
			  }
		}*/
	  });
	}
}
function randomnum (lowValue,highValue){
	var choice=highValue-lowValue+1;
	return Math.floor(Math.random()*choice+lowValue);
	}
</script>

<script>
	/**
	 * 移动设备进入web化课堂跳转任务详情页
	 */
	(
			function() {
				var reg = /(iphone|ios|android|mini|mobile|mobi|Nokia|Symbian|iPod|iPad|Windows\s+Phone|MQQBrowser|wp7|wp8|UCBrowser7|UCWEB|360\s+Aphone\s+Browser)/i;
				if (reg.test(navigator.userAgent)) {
					alert("手机")
				}
			})();

	/**
	 * 不允许四级域名访问，做一下跳转
	
	(function() {
	    var location = window.location;
	    if (location.host !== 'ke.qq.com') {
	        window.location.href = location.href.replace(location.host, 'ke.qq.com');
	    }
	})(); */
</script>
<!--[if lt IE 9]><script>var a ='header footer section aside nav article hgroup main time'.split(' ');while(a.length){document.createElement(a.pop());}</script><![endif]-->
<script>
	window.__DEBUG_STR__ = function() {
		return ''
	};
	window.__DIST_MODE__ = 'dist';
</script>
<link rel="stylesheet" type="text/css" href="${root}css/course/play.css">
<script type="text/javascript" src="${root}js/player/cyberplayer.js"></script>
<link rel="stylesheet" type="text/css"
	href="${root}css/zb/txp_flash.css">
	<style type="text/css">
    .jw-icon-barlogo-new{display: none;}
    </style>
</head>
<body style="overflow-y: hidden;">
	<div class="container clearfix">
		<div class="yq_main component-1" q-show="isShow" q-on="click: hide"
			id="ke-browsertip" style="display: none;">
			<span class="stress">您使用的浏览器版本过低，请升级浏览器以获得最佳体验</span>
		</div>
		<!--:include("/inc/zb/zb/component-2.html"){}  -->
		<div class="live-container">
			<div class="player-container" id="player-container">
			<!--:if(lubo==1){  -->
				<div id="playercontainer"></div>

<script type="text/javascript">
    var player = cyberplayer("playercontainer").setup({
    	width: "100%",
        height: "100%",
        file: "${(obj.playinfo[1].PlayURL!obj.playinfo[0].PlayURL)}", // 多码率m3u8播放地址
        autostart: true,
        stretching: "uniform",
        volume: 100,
        controls: true,
        ak: "4c36094624e64e9c954467c917530798" // 公有云平台注册即可获得accessKey
    });
</script>
				<!--:}else{  -->
				<div id="player"></div>
<script type="text/javascript">
    var player = cyberplayer("player").setup({
        width: "100%",
        height: "100%",
        file: "rtmp://live.iepsy.com/zb/${obj.id!1}", // <—rtmp直播地址
        fallbackfile: "http://live.iepsy.com/zb/${obj.id!1}.m3u8", // <— 备用播放地址，为了电脑上用rtmp流播放，手机上播放设置hls流
        autostart: true,
        stretching: "uniform",
        volume: 100,
        controls: true,
        ak: "4c36094624e64e9c954467c917530798" // 公有云平台注册即可获得accessKey
    });
</script>
    <!--:}  -->
			</div>
			
			<!--:include("/inc/zb/zb/component-3.html"){}  -->
		</div>
		
		<!--:include("/inc/course/play/component-6.html"){}  -->
		<!--:include("/inc/course/play/component-9.html"){}  -->
	</div>

	<div>
		<div class="xj_container component-10" q-show="isShow" id="dialog-msg"
			style="display: none;">
			<div class="xj_main dialog">
				<div tabindex="-1" class="overlay"></div>
				<div class="container">
					<div class="dialog-head">
						<span q-text="head"></span><i class="close-btn icon-font i-close"
							q-on="click: closeWindow"></i>
					</div>
					<div class="dialog-body">
						<i class="icon-font i-alert"></i>
						<div class="tip">
							<p class="header" q-text="title"></p>
							<span class="text" q-text="content"></span>
						</div>
					</div>
					<div class="btn-group">
						<span class="btn btn-confirm" q-show="isShowCancelBtn"
							q-on="click: dialogCancel" q-text="cancelText"
							style="display: none;"></span>
					</div>
				</div>
			</div>
		</div>
	</div>


<script src="${root}assets/layui/layui.js" charset="utf-8"></script>
	<script type="text/javascript">
	
		/*$(".menu-toggle-icon").click(function() {
			if ($(".ke-playlist").css("display") == "none") {
				$(".ke-playlist").css("display", "block")
				$(this).addClass("js-active")
			} else {
				$(".ke-playlist").css("display", "none")
				$(this).removeClass("js-active")
			}
		})*/
		 var ws;
		var WS_URL = window.location.host + '' + "/websocket"
		console.log(WS_URL)
		if (location.protocol == 'http:') {
			ws = new WebSocket("ws://"+WS_URL);
		} else { // 如果页面是https,那么必须走wss协议
			ws = new WebSocket("wss://"+WS_URL);
		}
		ws.onmessage = function(event) {
			 var re = JSON.parse(event.data);
		    if (re.room == "zb${obj.id}") {//一个房间
		    	$(".chat-list").append("<div class=\"student\">\n" +
						"								<span class=\"nick\">"+re.nickname+":"+getdate()+"</span> <span class=\"content\">"+re.msg+"</span> " +
						"							</div>")
		    }
		    var len=$('.chat-list').children().length;
			if(len==7){
			$(".chat-list").find(".student")[0].remove();
			}
		};
		ws.onopen = function(event) {
		    // 加入home房间
			ws.send(JSON.stringify({room:'zb${obj.id}','action':'join','msg':'加入房间','nickname':'${session.user.nickname!"匿名"}'}));
		   /**/
			$(".chat-list").append("<div class=\"student\">\n" +
					"								<span class=\"nick\">${session.user.nickname!'匿名'}加入房间</span> <i class=\"icon-font i-alert\" title=\"信息发送失败\" style=\"display: none;\"></i> " +
					"							</div>")
			$(".chat-list").find(".student")[0].remove();
			/*$(".member-list").append("<li class=\"list-item\">\n" +
					"						<span class=\"avatar avatar-stu-male\"></span> \n" +
					"						<span class=\"member-name\" >${session.user.nickname!'匿名'}</span>\n" +
					"					</li>")*/
		};
		$(".submit-btn").click(function(){
			ws.send(JSON.stringify({room:'zb${obj.id}',action:'join',msg:$('#editor-content').text(),nickname:'${session.user.nickname!"匿名"}'}));
			//$.get("${root}json/zb/websocket",{room:'zb${obj.id}',action:'join',msg:$('#editor-content').text(),nickname:'${session.user.nickname!"匿名"}'})
			$.getJSON('${root}json/zb/danmu1',{
				id:'${obj.id!1}',
         	   info:$('#editor-content').text(), //文字 
        	   href:'', //链接 
        	   close:false, //显示关闭按钮 
        	   speed:8, //延迟,单位秒,默认8 
        	   color:'#ffffff', //颜色,默认白色 
        	   old_ie_color:'#ffffff', //ie低版兼容色,不能与网页背景相同,默认黑色 
        	 },function(data){})
			$('#editor-content').text("")
			
		})
		
		function getdate() {
    var date = new Date();
    var seperator1 = "-";
    var seperator2 = ":";
    var month = date.getMonth() + 1;
    var strDate = date.getDate();
    var minutes=date.getMinutes();
    if (month >= 1 && month <= 9) {
        month = "0" + month;
    }
    if (strDate >= 0 && strDate <= 9) {
        strDate = "0" + strDate;
    }
    if (minutes >= 0 && minutes <= 9) {
    	minutes = "0" + minutes;
    }
    var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
            + " " + date.getHours() + seperator2 + minutes
            + seperator2 + date.getSeconds();
    return currentdate;
}
		function back(){
	    	if(history.length>0){
	    		location.href="${root}zb/"
	    	}else{
	    		history.go(-1);
	    	}
	    }
	</script>
</body>

</html>